<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
	<link rel="stylesheet" type="text/css" href="<?php echo base_url() . '/style/admin/css/public.css' ?>">
	<title>Document</title>
	<style type="text/css">
		span{
			color: #f00;
		}
	</style>
</head>
<body>
	<form action="" method="POST">
		<table class="table">
			<tr>
				<td class="th" colspan="10">添加管理员</td>
			</tr>
			<tr>
				<td>用户名</td>
				<td><input type="text" name="username" value="<?php echo set_value('username', isset($admin[0]['username'])?$admin[0]['username']:'') ?>"/>
					<?php echo form_error('username','<span>','</span>') ?>
				</td>
			</tr>
			<tr>
				<td>分组</td>
				<td>
					<select name="gid">
						<?php foreach ($roles as $key => $val): ?>
							<option value="<?php echo $val['id'] ?>"<?php echo set_select('gid', $val['id'], isset($admin['gid']) && $val['id']==$admin['gid']?true:false) ?>><?php echo $val['title'] ?></option>
						<?php endforeach ?>
					</select>

				</td>
			</tr>
			<tr>
				<td>密码</td>
				<td>
					<input type="password" name="passwd" value="<?php echo set_value('passwd', isset($admin[0]['password'])? $admin[0]['password'] : '') ?>" />
					<?php echo form_error('passwd', '<span>', '</span>') ?>
				</td>
			</tr>
			<tr>
				<td>确认密码</td>
				<td>
					<input type="password" name="repasswd" value="<?php echo set_value('repasswd', isset($admin[0]['password'])? $admin[0]['password'] : '') ?>" />
				</td>
			</tr>
			<tr>
				<td colspan="10"><input type="submit" value="提交" class="input_button"/></td>
			</tr>
		</table>
	</form>
	<table class="table">
		<tr>
			<td class="th" colspan="10">用户列表</td>
		</tr>
		<tr>
			<td>UID</td>
			<td>用户名</td>
			<td>所属组</td>
			<td>操作</td>
		</tr>
		<?php foreach($users as $k => $v): ?>
		<tr>
			<td><?php echo $v['uid'] ?></td>
			<td><?php echo $v['username'] ?></td>
			<td><?php echo $v['title'] ?></td>
			
			<td>
				[<a href="<?php echo site_url('admin/admin/manage_admin/'.$v['uid']) ?>">编辑</a>]
				[<a href="<?php echo site_url('admin/admin/del_admin/'.$v['uid']) ?>">删除</a>]
			</td>
		</tr>
		<?php endforeach; ?>
	</table>
</body>
</html>